package watermark;

import javax.swing.*;
import java.awt.image.BufferedImage;
/**
 * 预览水印效果
 * @author syt
 */
public class PreviewImage extends JDialog {

    private static final long serialVersionUID = 1L;

    public PreviewImage(BufferedImage buffImg) {
        WaterMark.getInstance().getLabel().setIcon(new ImageIcon(buffImg));
        int midX = WaterMark.getInstance().getContentPane().getWidth() / 2 - buffImg.getWidth() / 2;
        int midY = WaterMark.getInstance().getContentPane().getHeight() / 2 - buffImg.getHeight() / 2;
        WaterMark.getInstance().getLabel().setBounds(midX, midY, buffImg.getWidth(), buffImg.getHeight());
    }
}

